class Solution {
    public int cuttingRope(int n) {
        if (n == 2) return 1;
        if (n == 3) return 2;
        int a = n / 3;
        int b = n % 3;
        if (b == 0) {
            return (int) Math.pow(3, a);
        } else if (b == 1) {
            return (int) (Math.pow(3, a - 1) * 4);
        } else {
            return (int) (Math.pow(3, a) * b);
        }
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.cuttingRope(10));
    }
}